let vm1=new Vue({
    el:"#articleDetailMain",
    data:{
        userLoginInfo:{},
        flag:'',
        articleList:{},
        collectArticleUser:{}
    },
    methods:{
        logout:function(){
            axios({
                url:`user/logout`,
            }).then(()=>{
                sessionStorage.clear();
                location.href='logout';
            })
        },
        /**
         * 我的那些朋友 也关注了这篇文章
         */
        getfollowList:function () {
            axios({
                url:`article/followArticleMyFriend/${this.articleList.id}`,
                method:'get'
            }).then(res=>{
                if (res.data.data.length<1){
                    this.collectArticleUser=[{realName:'抱歉！还没有小伙伴关注该文章'}]
                } else {
                    this.collectArticleUser=res.data.data
                }
            })
        },
        /**
         * 取消文章收藏
         */
        unArticleCollect:function () {
            axios({
                url:`article/unArticleCollect/${this.articleList.id}`,
                method: 'get'
            }).then(res=>{
                let frameIndex = parent.layer.getFrameIndex(window.name);
                parent.layer.close(frameIndex);

                parent.alert(res.data.message+"-->影响数："+res.data.data);

                console.log(parent.Vue)
            })
        }
    },
    created:function () {
        this.flag=3;
        let userInfo = sessionStorage.getItem("vmUserInfo");
        if (userInfo!=null){
            this.userLoginInfo= JSON.parse(userInfo);
        } else{
            location.href="";
        }
        this.articleList=parent.layer.articleList;
        this.getfollowList();
    },
    mounted(){
        // window事件对象调用this.xxx
        // window.onClickKeyCode=this.xxx
    },
});